package org.microsites.service.impl;

import java.util.List;

import org.microsites.domain.dao.GenericDAO;
import org.microsites.domain.model.Entity;
import org.microsites.service.GenericService;

public abstract class GenericServiceImpl<T extends Entity> implements GenericService<T> {

	@Override
	public void create(T u) {
		getDAO().create(u);
	}

	@Override
	public void delete(Long id) {
		getDAO().delete(id);
	}

	@Override
	public List<T> list() {
		return getDAO().list();
	}

	@Override
	public List<T> sublist(Long id) {
		return getDAO().sublist(id);
	}

	@Override
	public T load(Long id) {
		return getDAO().load(id);
	}

	@Override
	public void update(T u) {
		getDAO().update(u);
	}

	@Override
	public List<String> autocomplete(String column, String pattern) {
		return this.getDAO().autocomplete(column, pattern);
	}

	@Override
	public T edit(Long id) {
		return getDAO().load(id);
	}

	@Override
	public void keep(Long id) {
	}

	@Override
	public void release(Long id) {
	}

	public abstract GenericDAO<T> getDAO();
}
